package com.quick.DP.FactoryPattern.FactoryType;

import com.quick.DP.FactoryPattern.Audi;
import com.quick.DP.FactoryPattern.BMW;
import com.quick.DP.FactoryPattern.normal.CarType.Car;

class CarFactory {
    public static Car createCar(String brand) {
        switch (brand.toLowerCase()) {
            case "bmw":
                return new BMW();
            case "tesla":
                return new Tesla();
            case "audi":
                return new Audi();
            default:
                throw new IllegalArgumentException("未知品牌: " + brand);
        }
    }
}